<?php 
	session_start();
	$var1= $_SESSION["registrado"];
	$var2= $_SESSION["administrador"];
	if ($var1 == null): {
		echo ("User not registered");
	} elseif ($var2 == 0): { 
			echo ("User without permissions");
	} else : {
?>


<!doctype html>
<html xmlns:fb="http://www.facebook.com/2008/fbml">

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">

<link href="css/bootstrap.css" rel="stylesheet" media="screen">
<link href="css/bootstrap-responsive.css" rel="stylesheet"	media="screen">

<title>My project manager</title>

<style type="text/css">
  body {
    padding-top: 60px;
    padding-bottom: 40px;
  }
  .sidebar-nav {
    padding: 9px 0;
  
  }
    .container {
    padding-top: 100px;
  }

    .finish {
        padding-top: 500px;
        padding-left: 25px;
        padding-right: 25px;
  }
  

  
  @media (max-width: 980px) {
    /* Enable use of floated navbar text */
    .navbar-text.pull-right {
      float: none;
      padding-left: 5px;
      padding-right: 5px;
    }
  }
</style>

</head>

<body>
<?php include ('configuration.php'); ?>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/bootstrap.js"></script>


<div class="navbar navbar-inverse navbar-fixed-top">
	<div class="navbar-inner">
		<div class="container-fluid">
			<button type="button" class="btn btn-navbar" data-toggle="collapse"
				data-target=".nav-collapse">
				<span class="icon-bar"></span> <span class="icon-bar"></span> <span
					class="icon-bar"></span>
			</button>
			<a class="brand" href="http://localhost/bases--grupo10/homeAdmin.php?">My project manager</a>
			<div class="nav-collapse collapse">
				<p class="navbar-text pull-right">
				
					<a href="http://localhost/bases--grupo10/logout.php?" class="navbar-link">Log out</a>
				</p>
				<ul class="nav">
					<li class="active"><a href="http://localhost/bases--grupo10/homeAdmin.php?">Home</a></li>
					<li><a href="http://localhost/bases--grupo10/about.php?">About</a></li>
					<li><a href="http://localhost/bases--grupo10/contact.php?">Contact</a></li>
				</ul>
			</div>
		</div>
	</div>
</div>
	
<?php  
	$id_pro=$_GET['id_pro'];
     //consulta para sacar los datos del proyecto
	$q1 =  mysql_query ("select p.name_project, p.id_version, p.advantage, p.initial_date, p.final_date
                            from project p where p.id_project='$id_pro' and 
                                p.id_version=(select max(P2.id_version) from Project P2 
                                        where P.id_project=P2.id_project)");


    $row=mysql_fetch_array($q1) ;
    $name_project=$row["name_project"];
    $fecha=$row["initial_date"];
    $fecha2=$row["final_date"];
    $advantage=$row["advantage"];
    
?>    	
<div class="span12">
    <h1 class='muted'>Members and responsibles from project <u>  <?php echo $name_project ?></u></h1>
</div>   
 
<div class="span12">       					
<div class="span3">
	<div class="container-fluid">
        <div class="control-group">
        	<br/><br/><br/>
            <label class="control-label">Name project: <?php echo $name_project?> </label>
        </div>
		
		<div class="control-group">
			<label class="control-label">Initial date: <?php echo $fecha?> </label>
        </div>

        <div class="control-group">
			<label class="control-label">Final date: <?php echo $fecha2?> </label>
        </div>
        
        <div class="control-group">
            <label class="control-label">Advance: <?php echo $advantage?></label>
         </div>        		
	</div>
</div>
	
<div class="span4">
<div class="container-fluid" >
	<br/><br/><br/>
    <table  class="table table-striped table-condensed" border="1" >
    	  <thead>
          <tr>
              <th>Members</th>                                     
          </tr>
     	 </thead>   
    	  <tbody>
        	<?php     
             $id_pro=$_GET['id_pro'];
             $q1 = mysql_query("SELECT id_member, name_member, surnames_member FROM project_member WHERE id_member IN (
                    SELECT id_member_participate FROM participate WHERE id_project_participate =  '$id_pro')") or die ("Query error");
             while($row=mysql_fetch_array($q1)){
                echo "<tr>";
                echo "<td>" . $row["name_member"] . " ".$row['surnames_member']. "</td>";
                echo "</tr>";
             }         
             ?>
    	    </tbody>	
        </table>
    </div>
</div>

<div class="span4">
	<div class="container-fluid" >
	<br/><br/><br/>
	<table  class="table table-striped table-condensed" border="1" >
		  <thead>
	      <tr>
	          <th>Responsible</th>
	      </tr>
	 	 </thead>   
		  <tbody>
		<?php
         $id_pro=$_GET['id_pro'];
         $q1 = mysql_query("SELECT id_member, name_member, surnames_member FROM project_member WHERE id_member IN (
            SELECT id_member_participate FROM participate WHERE id_project_participate ='$id_pro' 
                AND  `is_responsible` =  1)") or die ("Query error");
         while($row=mysql_fetch_array($q1)){
            echo "<tr>";
            echo "<td>" . $row["name_member"] . " ".$row['surnames_member']. "</td>";
            echo "</tr>";
         }         
         ?>
   		    </tbody>
   		 </table>   
		</div>
	</div>
</div>

</body>  
</html>  

<div class="finish">
    <a class="btn btn-primary pull-right" type="button" href="http://localhost/bases--grupo10/homeAdmin.php?">Finish</a>
    <a class="btn btn-primary pull-left" type="button" href="http://localhost/bases--grupo10/homeAdmin.php?">Back</a>
</div>

<?php 

}endif;?>